﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

namespace UrimTumim.Timesheet.Services.DataContracts
{
    /// <summary>
    /// Defines all properties and operations for a Task.
    /// </summary>
    [DataContract]
    public class TaskData
    {
        /// <summary>
        /// Task identifier that uniquely identifies a Task.
        /// </summary>
        [DataMember]
        public Guid? TaskGuid { get; set; }

        /// <summary>
        /// Level in the Task tree.
        /// </summary>
        [DataMember]
        public short TaskLevel { get; set; }

        /// <summary>
        /// Identifier as an integer to mantain compatibility with older systems.
        /// </summary>
        /// <remarks>
        /// Must be used with TaskLevel and TaskDomain.
        /// </remarks>
        [DataMember]
        public long? TaskId { get; set; }

        /// <summary>
        /// Domain where the task belongs.
        /// It could be the company name, a department name or a level name.
        /// </summary>
        [DataMember]
        public string TaskDomain { get; set; }

        /// <summary>
        /// Title of the Task.
        /// </summary>
        [DataMember]
        public string Title { get; set; }

        /// <summary>
        /// Description of the Task.
        /// </summary>
        [DataMember]
        public string Description { get; set; }
        
        /// <summary>
        /// Parent task used to navigate in task hierarchy.
        /// </summary>
        [DataMember]
        public TaskData ParentTask { get; set; }
        
        /// <summary>
        /// List of child tasks. 
        /// All these tasks have this instance as their Parent Task.
        /// </summary>
        [DataMember]
        public IList<TaskData> ChildTasks { get; set; }
    }
}
